package com.example.extenddemo.demo;

import com.example.extenddemo.entity.Student;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.stereotype.Component;

/**
 * @ClassName Test
 * @Description TODO
 * @Author 郭敖
 * @Date 2024年02月22日 21:08
 * @Version 1.0
 */
@Component
@Slf4j
public class TestBeanFactory implements FactoryBean<Student> {
    @Override
    public Student getObject() throws Exception {
        log.warn("TestBeanFactory is Running {}", Thread.currentThread().getName());
        return new Student().setName("Alice").setAge(18);
    }

    @Override
    public Class<?> getObjectType() {
        return Student.class;
    }

    @Override
    public boolean isSingleton() {
        return FactoryBean.super.isSingleton();
    }
}
